/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.tewi.jeeunit.commands;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.tewi.commands.AbstractFrameworkCommand;
import pl.tewi.commands.FrameworkCommand;
import pl.tewi.contexts.ApplicationServerContext;
import pl.tewi.controller.ServerControllerFactory;
import pl.tewi.controllers.ServerController;

/**
 *
 * @author Marcin Kwapisz
 */
public class Logout extends AbstractFrameworkCommand {

    private static final Logger LOGGER = LoggerFactory.getLogger(Logout.class.getName());

    /**
     * 
     * @param fNext
     * @param context
     */
    public Logout(final FrameworkCommand fNext, final ApplicationServerContext context) {
        super(fNext, context);
    }

    @Override
    public void evaluate() throws Throwable {
        fNext.evaluate();

        ServerController controller = ServerControllerFactory.getServerController(applicationServerContext);
        LOGGER.debug("Logout");
        controller.logout();
    }
}
